package class202204._26_30._26;


import java.util.*;
import java.sql.*;

class Person{
    public String name;
    public int age;
    String sex;//默认的包访问权限

    //在一个构造方法中  可以去调用另外一个构造方法
    //这时候先打印带两个参数的 后打印不带参数的  注意：不能成环   而且只能放在第一行
    public Person(){
        this("zhenzhen",99);
        System.out.println("不带参数的构造方法");

    }

    /**
     * 构造方法          可以发生重载
     * @param name
     * @param age
     */
    public Person(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("带有两个参数的构造方法");
    }
    public void sleep(){
        int a = 0;
        System.out.println(a);
        //谁调用sleep谁就是this  : this 代表当前对象的引用  person2
        System.out.println(this.name + "正在吃饭！");

    }
    public void eat(){
        this.sleep();
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
public class TestDemo {

    public  String sex;

    public static void fun2(int a) {
        System.out.println(a);
    }

    public static void main(String[] args) {
        fun2(10);
    }

    public static void main5(String[] args) {
        com.bit.demo1.TestDemo testDemo = new com.bit.demo1.TestDemo();

    }

    public static void main4(String[] args) {
        double result = Math.sqrt(Math.pow(3, 2) + Math.pow(4, 2));

    }

    public static void main3(String[] args) {
        //java.util.Date date = new java.util.Date();
        //Date date = new Date();//会报错  不知道倒那个包
        java.util.Date date = new java.util.Date();
        System.out.println(date.getTime());
        int[] array = {1,2,3,4};
        System.out.println(Arrays.toString(array));
    }

    public static void main2(String[] args) {
        //Person person1 = new Person();
        System.out.println(new Person());
        //跟上面一个效果
        /*System.out.println("================================");
        Person person2 = new Person();
        System.out.println("================================");
        Person person3 = new Person("weiwei",98);*/
    }

    public static void main1(String[] args) {
        Person person1 = new Person();//Person()就是调用不带参数的构造方法
        person1.name = "a wei";
        person1.sleep();

        Person person2 = new Person();//Person()就是调用不带参数的构造方法
        person2.name = "zhenzhen";
        person2.sleep();

    }
}
